<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Utente</title>
<link rel="stylesheet" href="andreas08.css" type="text/css" media="screen,projection" />
<script type="text/javascript" src="../../../js/page.js"></script>
<script type="text/javaScript">
function work(par){
    if(par == 2){
        if(!confirm("Sei sicuro di voler cancellare questo lavoro?"))
            return false;
    }
    var leftS = (screen.width - 200) / 2;
    var topS = (screen.height - 180) / 2;
    document.forms[0]._i.value = <?php print $_i ?>;
    document.forms[0].funzione.value = par;
    document.forms[0].submit();
}
</script>
</head>
<body <?php if(isset($msg)) print("onLoad=\"alert('".$msg."'); window.close(); window.opener.document.location.href='$referer'\"") ?> style="background-color: #fff">
    <p style="text-align: center; padding-left: 30px;  font-size: 12px; font-weight: bold">Gestione documenti</p>
    <form action="dettaglio_lavoro.php?upd=1" method="post" enctype="multipart/form-data" style="">
    <fieldset style="width: 550px; border: 1px solid; padding-top: 10px; margin-left: auto; margin-right: auto; margin-top: 20px">
    <legend style="font-weight: bold;">  Dati di base </legend>
    <table width="530">
        <tr>
            <td class="Titolo" align="left" style="color: #003366;width: 150px; padding-left: 10px; font-weight: bold">Autore</td>
            <td style="width: 380px">
                <input type="text" name="studente" style="width: 380px; font-size: 11px; border: 1px solid" value="<?php if(isset($current_work)) print($current_work['autore']) ?>" />
            </td>
        </tr>
        <tr>
            <td colspan="2" style="height: 15px">&nbsp;&nbsp;&nbsp;</td>
        </tr>
        <tr>
            <td class="Titolo" align="left" style="color: #003366;width: 150px; padding-left: 10px; font-weight: bold">Anno e classe</td>
            <td style="width: 380px">
                <select name="anno" style="width: 150px; border: 1px solid; font-size: 11px">
                <?php 
                while($anno = $res_anni->fetch_assoc()){
                ?>
                	<option value="<?php print $anno['descrizione'] ?>" <?php if($anno['descrizione']==$current_work['anno']) print "selected='selected'" ?>><?php print $anno['descrizione']?></option>
                <?php 
                }
                ?>
                </select>
                <select name="classe" style="width: 150px; margin-left: 70px; border: 1px solid; font-size: 11px">
                <?php 
                while($cls = $res_classi->fetch_assoc()){
                ?>
                	<option value="<?php print $cls['id_classe'] ?>" <?php if($cls['id_classe'] == $current_work['classe']) print("selected='selected'") ?>><?php print $cls['classe']." ".$cls['sezione'] ?></option>
                <?php 
                }
                ?>
                </select>
            </td>
        </tr>
        <tr>
            <td colspan="2">&nbsp;&nbsp;&nbsp;</td>
        </tr>
    </table>
    </fieldset>
    <fieldset style="width: 550px; border: 1px solid; padding-top: 10px; margin-top: 30px; margin-left: auto; margin-right: auto">
    <legend style="font-weight: bold"> Dati file </legend>
    <table width="530">
        <tr>
            <td class="Titolo" align="left" style="color: #003366;width: 150px; padding-left: 10px; font-weight: bold">Titolo</td>
            <td style="width: 380px">
                <input type="text" name="titolo" style="width: 380px; font-size: 11px; border: 1px solid" value="<?php if(isset($current_work)) print($current_work['titolo']) ?>" />
            </td>
        </tr>
        <tr>
            <td colspan="2">&nbsp;&nbsp;&nbsp;</td>
        </tr>
        <tr>
            <td class="Titolo" align="left" style="color: #003366;width: 150px; padding-left: 10px; font-weight: bold">Abstract</td>
            <td style="width: 380px">
                <textarea name="abstract" style="width: 380px; height: 50px"><?php if(isset($current_work)) print($current_work['abstract']) ?></textarea>
            </td>
        </tr>
        <tr>
            <td colspan="2">&nbsp;&nbsp;&nbsp;</td>
        </tr>
        <tr>
            <td class="Titolo" align="left" style="color: #003366;width: 150px; padding-left: 10px; font-weight: bold">File</td>
            <td style="width: 380px">
            <?php if(isset($current_work)){ ?>
            	<input type="text" name="fname" class="file" style="width: 380px; font-size: 11px; border: 1px solid" value="<?php print $current_work['file'] ?>"/>
            <?php }  else{ ?>
            	<div class="fileinputs" style="width: 380px">
                	<input type="file" name="fname" class="file" style="width: 380px; font-size: 11px; border: 1px solid"/>
                </div>
            <?php } ?>
            </td>
        </tr>
        <tr>
            <td colspan="2">&nbsp;&nbsp;&nbsp;
            <input type="hidden" name="funzione" />
		    <input type="hidden" name="_i" />
		    <input type="hidden" name="path" value="<?php if(isset($current_work)) print $path ?>"/>
		    <input type="hidden" name="oldfile" value="<?php if(isset($current_work)) print $current_work['file'] ?>"/>
		    <input type="hidden" name="referer" value="<?php print $referer ?>" />
            </td>
        </tr>
    </table>
    </fieldset>
    <div style="margin-right: 40px; margin-top: 30px; width: 592px; text-align: right; padding-bottom: 40px">
        <a href="#" onclick="work(<?php if(isset($_REQUEST['_i']) && $_REQUEST['_i'] != 0) print("3"); else print("1"); ?>)" style="" >Registra</a>&nbsp;&nbsp;|&nbsp;&nbsp;
        <?php if(isset($_REQUEST['_i']) && $_REQUEST['_i'] != 0){
        ?>
        <a href="#" onclick="work(2)" >Elimina lavoro</a>&nbsp;&nbsp;|&nbsp;&nbsp;
        <?php
        }
        ?>
        <a href="#" onclick="window.close()" style="" >Chiudi</a>
    </div>
   </form>
</body>
</html>